function buildName(firstName = "Will", lastName: string) {
    return firstName + " " + lastName;
}

let result111 = buildName("Bob");                  // error, too few parameters
let result122 = buildName("Bob", "Adams", "Sr.");  // error, too many parameters
let result133 = buildName("Bob", "Adams");         // okay and returns "Bob Adams"
let result144 = buildName(undefined, "Adams");     // okay and returns "Will Adams"


function buildName8(firstName: string, ...restOfName: string[]) {
    return firstName + " " + restOfName.join(" ");
}

let employeeName = buildName8("Joseph", "Samuel", "Lucas", "MacKinzie");

interface UIElement {
    addClickListener(onclick: (this: void, e: Event) => void): void;
}

class Handler {
    info: string;
    onClickBad(this: Handler, e: Event) {
        // oops, used this here. using this callback would crash at runtime
        this.info = e.message;
    }
}
let h = new Handler();
let uiElement=new UIElement();
uiElement.addClickListener(h.onClickBad); // error!